<script setup>
import { RouterView, useRouter } from 'vue-router'

const router = useRouter()
const handleSelect = (path) => {
  router.push(path)
}
</script>

<template>
  <el-container class="app-container">
    <el-aside width="200px">
      <el-menu default-active="/" class="el-menu-vertical" @select="handleSelect">
        <el-menu-item index="/">
          <el-icon>
            <Document />
          </el-icon>
          <span>文章列表</span>
        </el-menu-item>

        <el-menu-item index="/edit">
          <el-icon>
            <Edit />
          </el-icon>
          <span>新建文章</span>
        </el-menu-item>



      </el-menu>
    </el-aside>
    <el-container>
      <el-header>
        <h2>文章管理系统</h2>
      </el-header>
      <el-main>
        <RouterView />
      </el-main>
    </el-container>
  </el-container>
</template>

<style scoped>
.app-container {
  min-height: 100vh;
}

.el-header {
  background-color: #409EFF;
  color: white;
  display: flex;
  align-items: center;
}

.el-main {
  padding: 20px;
  background-color: #f0f2f5;
}

.el-aside {
  background-color: #fff;
  border-right: solid 1px #e6e6e6;
}

.el-menu-vertical {
  border-right: none;
}
</style>